# 组合指的是某一个对象拥有一个属性，该属性的值是另外一个类的对象
class People:
    school = "不造啊"
    def __init__(self,name,age,sex):
        self.name = name
        self.age = age
        self.sex = sex
class Student(People):
    def __init__(self,name,age,sex,score=0):
        super().__init__(name,age,sex)
        self.score = score
class Teacher(People):
    def __init__(self,name,age,sex,course=[]):
        super().__init__(name,age,sex)
        self.course = course
    def tell_info1(self):
        for i in self.course:
            i.tell_info()
class Course:
    def __init__(self,c_name,c_price):
        self.c_name = c_name
        self.c_price = c_price
    def tell_info(self):
        print("<课程名：%s，价格%s>"%(self.c_name,self.c_price))
if __name__ == '__main__':
    # 创建了一个老师对象
    t1 = Teacher('小白',18,'男')
    # 创建课程
    c_python = Course("python",100)
    c_java = Course('java',10)
    # 把这两个课程，加入到老师类的course列表里
    t1.course.append(c_python)
    t1.course.append(c_java)
    # 调用tell_info1方法
    t1.tell_info1()





